import { PanelDataProvider } from '../interface';
import { PanelController } from '../panel-controller';
import { data } from './data';

export class PanelInstanceController extends PanelController {
  async fetchDataItems(key: string): Promise<PanelDataProvider[]> {
    const items = data.getItems(key);
    const providers = items.map(item => {
      const fn = this.getDataProvider(item.pvparttype);
      return fn(item);
    });
    return providers;
  }
}
